@glodon-aiot/agent-cli-ui 3.4.1-beta.2 → 3.4.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/Dialog/AgentChat/index.mjs +274 -270
- package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
- package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
- package/dist/es/src/style11.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style20.css +1 -1
- package/dist/es/src/style21.css +1 -1
- package/dist/es/src/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/src/style27.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style30.css +1 -1
- package/dist/es/src/style31.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.js +53 -53
- package/package.json +3 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var ln = Object.defineProperty, dn = Object.defineProperties;
|
|
2
|
+
var cn = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var gt = Object.getOwnPropertySymbols;
|
|
4
|
+
var fn = Object.prototype.hasOwnProperty, gn = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Te = (x, k, o) => k in x ? ln(x, k, { enumerable: !0, configurable: !0, writable: !0, value: o }) : x[k] = o, ut = (x, k) => {
|
|
6
6
|
for (var o in k || (k = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var o of
|
|
10
|
-
|
|
7
|
+
fn.call(k, o) && Te(x, o, k[o]);
|
|
8
|
+
if (gt)
|
|
9
|
+
for (var o of gt(k))
|
|
10
|
+
gn.call(k, o) && Te(x, o, k[o]);
|
|
11
11
|
return x;
|
|
12
|
-
},
|
|
13
|
-
var D = (x, k, o) => (
|
|
12
|
+
}, ht = (x, k) => dn(x, cn(k));
|
|
13
|
+
var D = (x, k, o) => (Te(x, typeof k != "symbol" ? k + "" : k, o), o);
|
|
14
14
|
var j = (x, k, o) => new Promise((Y, e) => {
|
|
15
15
|
var L = (E) => {
|
|
16
16
|
try {
|
|
@@ -18,49 +18,49 @@ var j = (x, k, o) => new Promise((Y, e) => {
|
|
|
18
18
|
} catch (P) {
|
|
19
19
|
e(P);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, ve = (E) => {
|
|
22
22
|
try {
|
|
23
23
|
p(o.throw(E));
|
|
24
24
|
} catch (P) {
|
|
25
25
|
e(P);
|
|
26
26
|
}
|
|
27
|
-
}, p = (E) => E.done ? Y(E.value) : Promise.resolve(E.value).then(L,
|
|
27
|
+
}, p = (E) => E.done ? Y(E.value) : Promise.resolve(E.value).then(L, ve);
|
|
28
28
|
p((o = o.apply(x, k)).next());
|
|
29
29
|
});
|
|
30
|
-
import { jsx as c, jsxs as z, Fragment as
|
|
31
|
-
import { memo as
|
|
32
|
-
/* empty css */import { Spin as
|
|
33
|
-
import
|
|
34
|
-
import { IHistoryRole as J, ChatMessageRole as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import { v4 as
|
|
38
|
-
import
|
|
39
|
-
import { configuration as
|
|
40
|
-
import { NET_OPEN_STATUS as $, MB as
|
|
41
|
-
import
|
|
42
|
-
import { getImageExtension as
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import { CameraOutlined as
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import { useMemoizedFn as
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import { useSessionState as
|
|
58
|
-
import
|
|
59
|
-
const
|
|
60
|
-
icon:
|
|
30
|
+
import { jsx as c, jsxs as z, Fragment as un } from "react/jsx-runtime";
|
|
31
|
+
import { memo as hn, forwardRef as mn, useState as h, useRef as K, useContext as yn, useEffect as C, useMemo as pn, useImperativeHandle as vn } from "react";
|
|
32
|
+
/* empty css */import { Spin as mt, Divider as kn, Button as W, Space as me, Upload as wn, Tooltip as bn, Popover as xn, notification as ye, message as u } from "antd";
|
|
33
|
+
import ie from "../../components/Iconfont/index.mjs";
|
|
34
|
+
import { IHistoryRole as J, ChatMessageRole as yt, PromptVariableType as pe } from "@glodon-aiot/apis";
|
|
35
|
+
import kt from "./HistoryItem/index.mjs";
|
|
36
|
+
import wt from "dayjs";
|
|
37
|
+
import { v4 as Oe } from "uuid";
|
|
38
|
+
import In from "../../context.mjs";
|
|
39
|
+
import { configuration as Nn } from "@glodon-aiot/bot-client-sdk";
|
|
40
|
+
import { NET_OPEN_STATUS as $, MB as Cn } from "../../constant.mjs";
|
|
41
|
+
import Ln from "../../components/FilePreview/index.mjs";
|
|
42
|
+
import { getImageExtension as En } from "../../utils/index.mjs";
|
|
43
|
+
import Pn from "../../QuillEditor/index.mjs";
|
|
44
|
+
import Tn from "../../components/Recommend/index.mjs";
|
|
45
|
+
import Fn from "../../components/Greeting/index.mjs";
|
|
46
|
+
import On from "../../Footer/index.mjs";
|
|
47
|
+
import { CameraOutlined as Hn, PlusOutlined as Rn } from "@ant-design/icons";
|
|
48
|
+
import Dn from "./Tools/UploadKnowledgeFiles/index.mjs";
|
|
49
|
+
import Un from "../UploadingPrompt/index.mjs";
|
|
50
|
+
import Mn from "./PromptSetting/index.mjs";
|
|
51
|
+
import { useMemoizedFn as Fe } from "ahooks";
|
|
52
|
+
import jn from "./Tools/SessionListDrawer/index.mjs";
|
|
53
|
+
import zn from "./Tools/SessionHistoryDrawer/index.mjs";
|
|
54
|
+
import Vn from "react-infinite-scroll-component";
|
|
55
|
+
import An from "./Tools/ConnectToNetwork/index.mjs";
|
|
56
|
+
import qn from "./Tools/PromptManager/index.mjs";
|
|
57
|
+
import { useSessionState as Bn } from "../../hooks/useSessionState.mjs";
|
|
58
|
+
import $n from "../../assets/icon.svg.mjs";
|
|
59
|
+
const Yn = hn(kt), pt = {
|
|
60
|
+
icon: $n,
|
|
61
61
|
text: "今天我能帮你什么?"
|
|
62
62
|
};
|
|
63
|
-
class
|
|
63
|
+
class oe {
|
|
64
64
|
constructor(k, o, Y, e) {
|
|
65
65
|
D(this, "messageTime");
|
|
66
66
|
D(this, "isWaiting");
|
|
@@ -71,52 +71,52 @@ class ie {
|
|
|
71
71
|
D(this, "isSensitive");
|
|
72
72
|
D(this, "isSuspend");
|
|
73
73
|
D(this, "comment");
|
|
74
|
-
this.content = k, this.sessionId = o, this.role = Y, this.files = e, this.content = k, this.role = Y, this.sessionId = o, this.files = e, this.messageTime =
|
|
74
|
+
this.content = k, this.sessionId = o, this.role = Y, this.files = e, this.content = k, this.role = Y, this.sessionId = o, this.files = e, this.messageTime = wt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Oe(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
|
|
75
75
|
isAgree: 0
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const
|
|
80
|
-
var
|
|
79
|
+
const vt = 10, xi = mn((x, k) => {
|
|
80
|
+
var tt, nt, it, ot, st, rt, at, lt, dt, ct, ft;
|
|
81
81
|
const {
|
|
82
82
|
application: o,
|
|
83
83
|
docViewerUrl: Y = "",
|
|
84
84
|
currentSession: e,
|
|
85
85
|
onCreateSession: L,
|
|
86
|
-
embeddingService:
|
|
86
|
+
embeddingService: ve,
|
|
87
87
|
setCurrentSession: p,
|
|
88
88
|
networkStatus: E,
|
|
89
89
|
setNetworkStatus: P
|
|
90
|
-
} = x, [v, I] = h([]), [
|
|
90
|
+
} = x, [v, I] = h([]), [bt, se] = h(), [ke, He] = h(), H = K(null), {
|
|
91
91
|
service: T,
|
|
92
92
|
agentClient: N,
|
|
93
|
-
depId:
|
|
94
|
-
footer:
|
|
93
|
+
depId: xt,
|
|
94
|
+
footer: It,
|
|
95
95
|
transform: g,
|
|
96
|
-
defaultInput:
|
|
97
|
-
onMessage:
|
|
98
|
-
onHistoryLoad:
|
|
96
|
+
defaultInput: we,
|
|
97
|
+
onMessage: re,
|
|
98
|
+
onHistoryLoad: Re,
|
|
99
99
|
beforeMessageSend: V,
|
|
100
|
-
bodyStyle:
|
|
100
|
+
bodyStyle: Nt,
|
|
101
101
|
disabled: R,
|
|
102
102
|
features: s,
|
|
103
103
|
popupContainer: f,
|
|
104
|
-
icon:
|
|
105
|
-
sider:
|
|
106
|
-
mode:
|
|
107
|
-
} =
|
|
108
|
-
isSwitchingToExistingSession:
|
|
109
|
-
setIsSwitchingToExistingSession:
|
|
110
|
-
} =
|
|
104
|
+
icon: Ct,
|
|
105
|
+
sider: Lt,
|
|
106
|
+
mode: Et
|
|
107
|
+
} = yn(In), [De, be] = h(!1), m = K(v), Ue = K(void 0), [Pt, Tt] = h(0), [S, Q] = h(), [_, ae] = h(""), [Me, xe] = h(!1), le = K(null), [je, Ft] = h([]), [ze, G] = h(!1), [Ve, Ot] = h(!1), [Ht, Rt] = h(""), [Dt, X] = h(), [de, ce] = h({}), fe = K(null), Ae = K(null), Ie = K(null), [qe, Ut] = h(!1), [Mt, jt] = h([]), [zt, ge] = h(!0), [Vt, At] = h(!0), [Be, U] = h(!1), [Ne, A] = h(!1), [$e, qt] = h(!1), [O, ue] = h(typeof (s == null ? void 0 : s.promptVariables) == "object" ? s.promptVariables.default || [] : []), [Bt, $t] = h(typeof (s == null ? void 0 : s.knowledges) == "object" && s.knowledges.default || void 0), [Ye, M] = h(!1), [Ke, ee] = h(!1), [Yt, Z] = h(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), [We, he] = h(!1), [Kt, q] = h(!1), [Wt, Qt] = h(null), [te, Ce] = h(!1), [Qe, _e] = h(!1), {
|
|
108
|
+
isSwitchingToExistingSession: _t,
|
|
109
|
+
setIsSwitchingToExistingSession: Le
|
|
110
|
+
} = Bn();
|
|
111
111
|
C(() => {
|
|
112
|
-
if (
|
|
112
|
+
if (Qt(e), e === null)
|
|
113
113
|
q(!1);
|
|
114
114
|
else if (e === void 0)
|
|
115
115
|
q(!0);
|
|
116
116
|
else {
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
q(!0),
|
|
117
|
+
if (Wt === null) {
|
|
118
|
+
if (_t) {
|
|
119
|
+
q(!0), Le(!1);
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
q(!1);
|
|
@@ -138,7 +138,7 @@ const yt = 10, wi = un((x, k) => {
|
|
|
138
138
|
}
|
|
139
139
|
const n = (l) => {
|
|
140
140
|
var r;
|
|
141
|
-
(r = e == null ? void 0 : e.data) != null && r.id && (m.current = [...l].reverse(), I([...l].reverse()), !l || l.length < 10 ? ee(!1) : ee(!0), q(!1),
|
|
141
|
+
(r = e == null ? void 0 : e.data) != null && r.id && (m.current = [...l].reverse(), I([...l].reverse()), !l || l.length < 10 ? ee(!1) : ee(!0), q(!1), Re && Re({
|
|
142
142
|
applicationId: o.id,
|
|
143
143
|
sessionId: e.data.id,
|
|
144
144
|
histories: l
|
|
@@ -150,7 +150,7 @@ const yt = 10, wi = un((x, k) => {
|
|
|
150
150
|
}, [e]), C(() => {
|
|
151
151
|
const t = () => {
|
|
152
152
|
var n;
|
|
153
|
-
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables &&
|
|
153
|
+
(n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ue(e.promptVariables.sort((a, i) => a.key.localeCompare(i.key))), e.knowledges && $t(e.knowledges), P(e.netOpen));
|
|
154
154
|
};
|
|
155
155
|
return e == null || e.addEventListener("data:updated", t), () => {
|
|
156
156
|
e == null || e.removeEventListener("data:updated", t);
|
|
@@ -161,11 +161,11 @@ const yt = 10, wi = un((x, k) => {
|
|
|
161
161
|
return;
|
|
162
162
|
const t = (a) => {
|
|
163
163
|
var i;
|
|
164
|
-
console.error(a.message, a.cause, "e.case"),
|
|
164
|
+
console.error(a.message, a.cause, "e.case"), ye.config({
|
|
165
165
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
166
|
-
}),
|
|
166
|
+
}), ye.error({
|
|
167
167
|
message: ((i = a.cause) == null ? void 0 : i.message) || a.message
|
|
168
|
-
}),
|
|
168
|
+
}), ye.config({
|
|
169
169
|
getContainer: void 0
|
|
170
170
|
});
|
|
171
171
|
};
|
|
@@ -173,7 +173,7 @@ const yt = 10, wi = un((x, k) => {
|
|
|
173
173
|
e == null || e.removeEventListener("error", t);
|
|
174
174
|
};
|
|
175
175
|
}, [e]);
|
|
176
|
-
const
|
|
176
|
+
const Gt = () => {
|
|
177
177
|
var a;
|
|
178
178
|
if (!((a = e == null ? void 0 : e.data) != null && a.id) || !(o != null && o.id))
|
|
179
179
|
return;
|
|
@@ -187,16 +187,16 @@ const yt = 10, wi = un((x, k) => {
|
|
|
187
187
|
return;
|
|
188
188
|
} else
|
|
189
189
|
e.clear().then(() => {
|
|
190
|
-
const i = new
|
|
190
|
+
const i = new oe("", t, J.System);
|
|
191
191
|
i.isContext = !0, I([i, ...v]);
|
|
192
192
|
});
|
|
193
193
|
};
|
|
194
194
|
C(() => {
|
|
195
195
|
o != null && o.id && (T == null || T.getRecommendQues(o.id).then((t) => {
|
|
196
|
-
|
|
196
|
+
Ft(t);
|
|
197
197
|
}));
|
|
198
|
-
}, [
|
|
199
|
-
const
|
|
198
|
+
}, [xt, o]);
|
|
199
|
+
const Ge = (t) => j(void 0, null, function* () {
|
|
200
200
|
var y, F;
|
|
201
201
|
if (R) {
|
|
202
202
|
u.config({
|
|
@@ -206,7 +206,7 @@ const yt = 10, wi = un((x, k) => {
|
|
|
206
206
|
});
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
const n = t ||
|
|
209
|
+
const n = t || bt;
|
|
210
210
|
if (!(n != null && n.trim())) {
|
|
211
211
|
u.config({
|
|
212
212
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
@@ -225,7 +225,7 @@ const yt = 10, wi = un((x, k) => {
|
|
|
225
225
|
return;
|
|
226
226
|
} else
|
|
227
227
|
console.error("变量值不能为空", O == null ? void 0 : O.map((w) => !!(w != null && w.value)));
|
|
228
|
-
if (
|
|
228
|
+
if (Ne) {
|
|
229
229
|
u.config({
|
|
230
230
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
231
231
|
}), u.error("正在回复中"), u.config({
|
|
@@ -233,7 +233,7 @@ const yt = 10, wi = un((x, k) => {
|
|
|
233
233
|
});
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
|
-
if (
|
|
236
|
+
if (De) {
|
|
237
237
|
u.config({
|
|
238
238
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
239
239
|
}), u.error("等待初始化"), u.config({
|
|
@@ -241,7 +241,7 @@ const yt = 10, wi = un((x, k) => {
|
|
|
241
241
|
});
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
-
if (!
|
|
244
|
+
if (!zt) {
|
|
245
245
|
u.config({
|
|
246
246
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
247
247
|
}), u.error("正在解析文件"), u.config({
|
|
@@ -249,7 +249,7 @@ const yt = 10, wi = un((x, k) => {
|
|
|
249
249
|
});
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
252
|
-
if (
|
|
252
|
+
if (Me) {
|
|
253
253
|
u.config({
|
|
254
254
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
255
255
|
}), u.error("正在上传图片"), u.config({
|
|
@@ -257,20 +257,24 @@ const yt = 10, wi = un((x, k) => {
|
|
|
257
257
|
});
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
|
-
Q(void 0),
|
|
260
|
+
Q(void 0), ae("");
|
|
261
261
|
const i = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
|
|
262
262
|
if (!i) {
|
|
263
|
-
|
|
263
|
+
if (te)
|
|
264
|
+
return;
|
|
265
|
+
Ce(!0), L == null || L({
|
|
264
266
|
netOpen: E ? $.OPEN : $.CLOSE
|
|
265
267
|
}).then((w) => {
|
|
266
|
-
var B,
|
|
267
|
-
M(!0), P(!!((B = w.data) != null && B.netOpen)), Z(!!((
|
|
268
|
-
p == null || p(w), M(!1),
|
|
268
|
+
var B, ne;
|
|
269
|
+
M(!0), P(!!((B = w.data) != null && B.netOpen)), Z(!!((ne = w.data) != null && ne.enableNetOpen)), Xe(w).then(() => {
|
|
270
|
+
p == null || p(w), M(!1), He(n), Ce(!1);
|
|
269
271
|
});
|
|
272
|
+
}).catch((w) => {
|
|
273
|
+
Ce(!1);
|
|
270
274
|
});
|
|
271
275
|
return;
|
|
272
276
|
}
|
|
273
|
-
|
|
277
|
+
he(!0);
|
|
274
278
|
const l = _ ? `
|
|
275
279
|
${n}` : n;
|
|
276
280
|
let r;
|
|
@@ -281,53 +285,53 @@ ${n}` : n;
|
|
|
281
285
|
message: {
|
|
282
286
|
content: l,
|
|
283
287
|
sessionId: i,
|
|
284
|
-
role:
|
|
285
|
-
files:
|
|
288
|
+
role: yt.User,
|
|
289
|
+
files: de[i]
|
|
286
290
|
}
|
|
287
291
|
}) : r = !0;
|
|
288
292
|
} catch (w) {
|
|
289
293
|
r = !1;
|
|
290
294
|
}
|
|
291
|
-
if (
|
|
295
|
+
if (he(!1), r === !1)
|
|
292
296
|
return;
|
|
293
297
|
let d = n;
|
|
294
|
-
typeof r == "object" && (d = r.content || n), (yield e.setPromptVariables(O)) && (((F =
|
|
295
|
-
}),
|
|
296
|
-
const r = (t == null ? void 0 : t.promptVariables).filter((d) => d.type ? !((d.type ===
|
|
298
|
+
typeof r == "object" && (d = r.content || n), (yield e.setPromptVariables(O)) && (((F = de[i]) == null ? void 0 : F.length) > 0 ? Xt(d) : Ee(d));
|
|
299
|
+
}), Xe = (t) => new Promise((n, a) => j(void 0, null, function* () {
|
|
300
|
+
const r = (t == null ? void 0 : t.promptVariables).filter((d) => d.type ? !((d.type === pe.User || d.type === void 0) && d.key === "query") && !((d.type === pe.System || d.type === void 0) && d.key === "datetime") : d.key !== "query").map((d) => {
|
|
297
301
|
var y;
|
|
298
302
|
const b = (y = O.find((F) => F.key === d.key && F.type === d.type)) == null ? void 0 : y.value;
|
|
299
303
|
return d.value = b || "", d;
|
|
300
304
|
});
|
|
301
|
-
|
|
305
|
+
ue(r.sort((d, b) => d.key.localeCompare(b.key))), yield t == null ? void 0 : t.setPromptVariables(r).catch((d) => {
|
|
302
306
|
console.error(d), u.config({
|
|
303
307
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
304
308
|
}), u.error(d.message), u.config({
|
|
305
309
|
getContainer: void 0
|
|
306
310
|
});
|
|
307
311
|
}), n();
|
|
308
|
-
})),
|
|
312
|
+
})), Xt = (t) => {
|
|
309
313
|
var r, d, b;
|
|
310
|
-
if (
|
|
314
|
+
if (ge(!1), !((r = e == null ? void 0 : e.data) != null && r.id) || !(o != null && o.id))
|
|
311
315
|
return;
|
|
312
316
|
const n = ((d = e.data) == null ? void 0 : d.id) || "", a = [];
|
|
313
317
|
let i = [], l = /* @__PURE__ */ new Set();
|
|
314
|
-
(b =
|
|
318
|
+
(b = de[n]) == null || b.forEach((y) => {
|
|
315
319
|
l.has(y.id) || (i.push(y), l.add(y.id));
|
|
316
320
|
}), Promise.all(i.map((y) => T == null ? void 0 : T.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, y.id, {
|
|
317
321
|
enabled: 1
|
|
318
322
|
}).then((F) => {
|
|
319
323
|
a.push(y);
|
|
320
324
|
}))).then((y) => {
|
|
321
|
-
|
|
325
|
+
ge(!0), Ee(t, a);
|
|
322
326
|
}).catch((y) => {
|
|
323
327
|
throw Error(y);
|
|
324
328
|
});
|
|
325
329
|
};
|
|
326
330
|
C(() => {
|
|
327
|
-
if (!
|
|
331
|
+
if (!ke || !e || te)
|
|
328
332
|
return;
|
|
329
|
-
const t =
|
|
330
|
-
|
|
333
|
+
const t = ke, n = () => j(void 0, null, function* () {
|
|
334
|
+
he(!0);
|
|
331
335
|
const a = _ ? `
|
|
332
336
|
${t}` : t;
|
|
333
337
|
let i;
|
|
@@ -338,53 +342,53 @@ ${t}` : t;
|
|
|
338
342
|
message: {
|
|
339
343
|
content: a,
|
|
340
344
|
sessionId: e.id,
|
|
341
|
-
role:
|
|
342
|
-
files:
|
|
345
|
+
role: yt.User,
|
|
346
|
+
files: de[e.id]
|
|
343
347
|
}
|
|
344
348
|
}) : i = !0;
|
|
345
349
|
} catch (l) {
|
|
346
350
|
i = !1;
|
|
347
351
|
}
|
|
348
|
-
|
|
352
|
+
he(!1), i !== !1 && (Ee(t), He(void 0));
|
|
349
353
|
});
|
|
350
354
|
return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
|
|
351
355
|
e == null || e.removeEventListener("ready", n);
|
|
352
356
|
};
|
|
353
|
-
}, [
|
|
354
|
-
const
|
|
357
|
+
}, [ke, e, te]);
|
|
358
|
+
const Ee = (t, n) => j(void 0, null, function* () {
|
|
355
359
|
var y, F;
|
|
356
360
|
const a = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
|
|
357
361
|
if (!a)
|
|
358
362
|
return;
|
|
359
363
|
A(!0), U(!0);
|
|
360
364
|
const i = _ ? `
|
|
361
|
-
${t}` : t, l = new
|
|
362
|
-
|
|
365
|
+
${t}` : t, l = new oe(i, a, J.User, n);
|
|
366
|
+
se(void 0), X(void 0), m.current = [l, ...v], I(m.current), o.id && re && re({
|
|
363
367
|
applicationId: o.id,
|
|
364
368
|
sessionId: a,
|
|
365
369
|
message: l
|
|
366
370
|
});
|
|
367
|
-
const r = new
|
|
371
|
+
const r = new oe("", a, J.System);
|
|
368
372
|
r.isWaiting = !0, m.current = [r, ...m.current], I(m.current);
|
|
369
373
|
const d = (n == null ? void 0 : n.map((w) => w.id)) || [], b = {
|
|
370
|
-
stream:
|
|
374
|
+
stream: Nn.stream,
|
|
371
375
|
referenceFirst: !1
|
|
372
376
|
};
|
|
373
377
|
if (g != null && g.promptVariables) {
|
|
374
|
-
const w = O == null ? void 0 : O.reduce((B,
|
|
378
|
+
const w = O == null ? void 0 : O.reduce((B, ne) => (B[ne.key] = ne.value, B), {});
|
|
375
379
|
b.formatValues = w;
|
|
376
380
|
}
|
|
377
381
|
if (g != null && g.knowledges) {
|
|
378
|
-
const w =
|
|
382
|
+
const w = Bt;
|
|
379
383
|
b.knowledges = w;
|
|
380
384
|
}
|
|
381
385
|
yield e.send({
|
|
382
386
|
text: i,
|
|
383
387
|
fileIds: d,
|
|
384
388
|
files: n
|
|
385
|
-
}, b),
|
|
389
|
+
}, b), ce({
|
|
386
390
|
[a]: []
|
|
387
|
-
}), (F =
|
|
391
|
+
}), (F = fe.current) == null || F.update();
|
|
388
392
|
});
|
|
389
393
|
C(() => {
|
|
390
394
|
var a;
|
|
@@ -392,14 +396,14 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
392
396
|
if (!t)
|
|
393
397
|
return;
|
|
394
398
|
const n = (i) => {
|
|
395
|
-
if (!i.sessionId || i.sessionId && i.sessionId !==
|
|
399
|
+
if (!i.sessionId || i.sessionId && i.sessionId !== Ue.current || i.role === J.User)
|
|
396
400
|
return;
|
|
397
401
|
if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (U(!1), A(!1), m.current = m.current.filter((d) => !d.isWaiting), I([...m.current]), m.current = [...m.current], i.content))
|
|
398
|
-
return
|
|
402
|
+
return ye.error({
|
|
399
403
|
message: i.content
|
|
400
404
|
});
|
|
401
|
-
const l = i.actions || [], r = new
|
|
402
|
-
r.messageId = i.messageId ||
|
|
405
|
+
const l = i.actions || [], r = new oe(i.content, t, J.Robot);
|
|
406
|
+
r.messageId = i.messageId || Oe(), r.reasoningContent = i.reasoningContent, r.searchReference = i.searchReference, r.thinkingSecs = i.thinkingSecs, r.thinkingStatus = i.thinkingStatus, r.actions = l, r.isLoading = !0, r.searchingStatus = i.searchingStatus, m.current = m.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && I([r, ...m.current]), i.code === 11915 && (U(!1), A(!1), r.isLoading = !1, r.content = "请您换个问题问我吧~", r.isSensitive = !0, I([r, ...m.current])), i.index === -2 && (U(!1), A(!1), r.isLoading = !1, r.content = "回答已中止~", r.isSuspend = !0, I([r, ...m.current])), i.index === -1 && (U(!1), A(!1), r.isLoading = !1, r.reference = i.reference, I([r, ...m.current]), o.id && re && re({
|
|
403
407
|
applicationId: o.id,
|
|
404
408
|
sessionId: t,
|
|
405
409
|
message: r
|
|
@@ -412,89 +416,89 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
412
416
|
};
|
|
413
417
|
}, [e]), C(() => {
|
|
414
418
|
if (!e) {
|
|
415
|
-
|
|
419
|
+
be(!1);
|
|
416
420
|
return;
|
|
417
421
|
}
|
|
418
422
|
const t = (n) => {
|
|
419
|
-
|
|
423
|
+
be(n);
|
|
420
424
|
};
|
|
421
|
-
return
|
|
425
|
+
return be(e.frozen), e.addEventListener("frozen", t), () => {
|
|
422
426
|
e == null || e.removeEventListener("frozen", t);
|
|
423
427
|
};
|
|
424
428
|
}, [e]), C(() => {
|
|
425
429
|
if (!N)
|
|
426
430
|
return;
|
|
427
431
|
const t = N.questionContextMaxLength || 4e3;
|
|
428
|
-
|
|
432
|
+
Tt(t);
|
|
429
433
|
}, [N, T]), C(() => {
|
|
430
|
-
|
|
431
|
-
}, [
|
|
432
|
-
const
|
|
434
|
+
we && X(we.text);
|
|
435
|
+
}, [we]);
|
|
436
|
+
const Zt = (t) => {
|
|
433
437
|
const n = t.size;
|
|
434
438
|
return n <= 0 ? (u.config({
|
|
435
439
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
436
440
|
}), u.error("该文件为空,请重新上传"), u.config({
|
|
437
441
|
getContainer: void 0
|
|
438
|
-
}), !1) : n > 20 *
|
|
442
|
+
}), !1) : n > 20 * Cn ? (u.config({
|
|
439
443
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
440
444
|
}), u.error("图片须小于20M"), u.config({
|
|
441
445
|
getContainer: void 0
|
|
442
446
|
}), !1) : (Q(t), !1);
|
|
443
|
-
},
|
|
447
|
+
}, Jt = (t) => j(void 0, null, function* () {
|
|
444
448
|
var n;
|
|
445
|
-
return Q(t), (n = e == null ? void 0 : e.data) != null && n.id ?
|
|
449
|
+
return Q(t), (n = e == null ? void 0 : e.data) != null && n.id ? Ze(e, t) : new Promise((a) => {
|
|
446
450
|
M(!0), L == null || L({
|
|
447
451
|
netOpen: E ? $.OPEN : $.CLOSE
|
|
448
452
|
}).then((i) => {
|
|
449
453
|
var l, r;
|
|
450
|
-
p == null || p(i), M(!1), P(!!((l = i.data) != null && l.netOpen)), Z(!!((r = i.data) != null && r.enableNetOpen)), a(
|
|
454
|
+
p == null || p(i), M(!1), P(!!((l = i.data) != null && l.netOpen)), Z(!!((r = i.data) != null && r.enableNetOpen)), a(Ze(i, t));
|
|
451
455
|
});
|
|
452
456
|
});
|
|
453
|
-
}),
|
|
454
|
-
const a =
|
|
457
|
+
}), Ze = (t, n) => {
|
|
458
|
+
const a = En(n.name);
|
|
455
459
|
return new Promise((i) => {
|
|
456
460
|
var r;
|
|
457
461
|
const l = {
|
|
458
|
-
files: [`${
|
|
462
|
+
files: [`${Oe()}.${a}`],
|
|
459
463
|
isv: "minio",
|
|
460
464
|
knowledgeId: ((r = t.data) == null ? void 0 : r.id) || "",
|
|
461
465
|
type: 1
|
|
462
466
|
};
|
|
463
|
-
|
|
467
|
+
xe(!0), T == null || T.postTicket(l).then((d) => {
|
|
464
468
|
T.uploadMinioFile(d.minio, n).then(() => {
|
|
465
469
|
var w, B;
|
|
466
470
|
const b = (w = d.minio.endpoints) == null ? void 0 : w[0], y = d.minio.bucket, F = (B = d.minio.fileKeys) == null ? void 0 : B[0];
|
|
467
471
|
i(`${location.protocol}//${b}/${y}/${F}`);
|
|
468
472
|
}).catch(() => {
|
|
469
|
-
|
|
473
|
+
ae(""), Q(void 0);
|
|
470
474
|
}).finally(() => {
|
|
471
|
-
|
|
475
|
+
xe(!1);
|
|
472
476
|
});
|
|
473
477
|
}).catch(() => {
|
|
474
|
-
|
|
478
|
+
ae(""), Q(void 0), xe(!1);
|
|
475
479
|
});
|
|
476
480
|
});
|
|
477
481
|
};
|
|
478
482
|
C(() => {
|
|
479
483
|
const t = H.current;
|
|
480
|
-
t &&
|
|
484
|
+
t && !$e && t.scrollTo({
|
|
481
485
|
top: t.scrollHeight
|
|
482
486
|
});
|
|
483
487
|
}, [v]);
|
|
484
|
-
const
|
|
488
|
+
const Je = (t, n) => new Promise((a) => {
|
|
485
489
|
if (!n.file.url || !(o != null && o.id))
|
|
486
490
|
return a();
|
|
487
|
-
const i =
|
|
491
|
+
const i = ht(ut({}, n.file), {
|
|
488
492
|
type: 1
|
|
489
493
|
});
|
|
490
494
|
T == null || T.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
|
|
491
495
|
var l;
|
|
492
|
-
(l =
|
|
496
|
+
(l = fe.current) == null || l.update().finally(a);
|
|
493
497
|
});
|
|
494
|
-
}),
|
|
498
|
+
}), St = () => {
|
|
495
499
|
var t;
|
|
496
500
|
(t = e == null ? void 0 : e.data) != null && t.id && (U(!1), e.suspend());
|
|
497
|
-
},
|
|
501
|
+
}, en = (t) => {
|
|
498
502
|
const n = H.current;
|
|
499
503
|
n && setTimeout(() => {
|
|
500
504
|
n.scrollTo({
|
|
@@ -502,36 +506,36 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
502
506
|
behavior: t == null ? void 0 : t.behavior
|
|
503
507
|
});
|
|
504
508
|
}, t == null ? void 0 : t.ms);
|
|
505
|
-
},
|
|
509
|
+
}, tn = () => {
|
|
506
510
|
if (!H.current)
|
|
507
511
|
return;
|
|
508
512
|
const t = H.current.scrollTop <= -80;
|
|
509
|
-
|
|
510
|
-
},
|
|
513
|
+
qt(t);
|
|
514
|
+
}, nn = Fe((t) => {
|
|
511
515
|
var n, a;
|
|
512
|
-
(n =
|
|
513
|
-
}),
|
|
514
|
-
|
|
515
|
-
}),
|
|
516
|
+
(n = le.current) == null || n.update(t), (a = le.current) == null || a.focus();
|
|
517
|
+
}), on = Fe((t) => {
|
|
518
|
+
Ge(t);
|
|
519
|
+
}), sn = Fe(() => {
|
|
516
520
|
var n;
|
|
517
521
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
518
522
|
return;
|
|
519
523
|
m.current = [...v.slice(1, v.length)], I(m.current);
|
|
520
|
-
const t = new
|
|
524
|
+
const t = new oe("", e.data.id, J.System);
|
|
521
525
|
t.isWaiting = !0, m.current = [t, ...m.current], I(m.current), A(!0), U(!0), e.answerAgain();
|
|
522
526
|
});
|
|
523
527
|
C(() => {
|
|
524
528
|
var t, n;
|
|
525
|
-
|
|
529
|
+
Ue.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Ye && ((n = Ie.current) == null || n.clear());
|
|
526
530
|
}, [e]);
|
|
527
|
-
const
|
|
531
|
+
const rn = () => {
|
|
528
532
|
var a;
|
|
529
533
|
if (!((a = e == null ? void 0 : e.data) != null && a.id))
|
|
530
534
|
return;
|
|
531
535
|
const n = v[v.length - 1].messageTime;
|
|
532
536
|
e.fetchMessages({
|
|
533
537
|
endTime: n,
|
|
534
|
-
pageSize:
|
|
538
|
+
pageSize: vt
|
|
535
539
|
}).then((i) => {
|
|
536
540
|
const l = i || [];
|
|
537
541
|
if (!l || !(l != null && l.length)) {
|
|
@@ -540,7 +544,7 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
540
544
|
}
|
|
541
545
|
l.length < 10 ? ee(!1) : ee(!0), I([...v, ...l.reverse()]);
|
|
542
546
|
});
|
|
543
|
-
},
|
|
547
|
+
}, an = (t) => j(void 0, null, function* () {
|
|
544
548
|
var n, a;
|
|
545
549
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
546
550
|
P(t);
|
|
@@ -549,14 +553,14 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
549
553
|
return;
|
|
550
554
|
P(t);
|
|
551
555
|
}
|
|
552
|
-
}),
|
|
556
|
+
}), Pe = () => j(void 0, null, function* () {
|
|
553
557
|
e ? e.fetchData().then((t) => {
|
|
554
558
|
var n;
|
|
555
559
|
(n = e == null ? void 0 : e.data) != null && n.id && (P(t.netOpen), Z(t.enableNetOpen));
|
|
556
560
|
}) : (P(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), Z(o.arrange[0].enableNetOpen));
|
|
557
561
|
});
|
|
558
562
|
C(() => {
|
|
559
|
-
|
|
563
|
+
Pe();
|
|
560
564
|
}, [e]), C(() => {
|
|
561
565
|
requestAnimationFrame(() => {
|
|
562
566
|
var n, a;
|
|
@@ -580,7 +584,7 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
580
584
|
if (e)
|
|
581
585
|
return;
|
|
582
586
|
const t = () => {
|
|
583
|
-
const i = ((N == null ? void 0 : N.promptVariables) || []).filter((l) => l.type ? !(l.type ===
|
|
587
|
+
const i = ((N == null ? void 0 : N.promptVariables) || []).filter((l) => l.type ? !(l.type === pe.User && l.key === "query") && !(l.type === pe.System && l.key === "datetime") && l.status === 1 : l.key !== "query" && l.status === 1).map((l, r) => {
|
|
584
588
|
var b, y;
|
|
585
589
|
let d = "";
|
|
586
590
|
return typeof (s == null ? void 0 : s.promptVariables) == "object" && (d = ((y = (b = s.promptVariables.default) == null ? void 0 : b.find((F) => F.key === l.key && F.type === l.type)) == null ? void 0 : y.value) || ""), {
|
|
@@ -591,20 +595,20 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
591
595
|
type: l.type
|
|
592
596
|
};
|
|
593
597
|
});
|
|
594
|
-
|
|
598
|
+
ue([...i].sort((l, r) => l.key.localeCompare(r.key)));
|
|
595
599
|
};
|
|
596
600
|
return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
|
|
597
601
|
N == null || N.removeEventListener("ready", t);
|
|
598
602
|
};
|
|
599
603
|
}, [e, N, s == null ? void 0 : s.promptVariables]);
|
|
600
|
-
const
|
|
604
|
+
const Se = () => L == null ? void 0 : L({
|
|
601
605
|
netOpen: E ? $.OPEN : $.CLOSE
|
|
602
606
|
}).then((t) => {
|
|
603
607
|
var n, a;
|
|
604
|
-
return p == null || p(t), M(!1), P(!!((n = t.data) != null && n.netOpen)), Z(!!((a = t.data) != null && a.enableNetOpen)),
|
|
605
|
-
}),
|
|
608
|
+
return p == null || p(t), M(!1), P(!!((n = t.data) != null && n.netOpen)), Z(!!((a = t.data) != null && a.enableNetOpen)), Xe(t), t;
|
|
609
|
+
}), et = pn(() => {
|
|
606
610
|
var t;
|
|
607
|
-
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(
|
|
611
|
+
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(kt, {
|
|
608
612
|
application: o,
|
|
609
613
|
history: {
|
|
610
614
|
role: 1,
|
|
@@ -614,7 +618,7 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
614
618
|
sessionId: "",
|
|
615
619
|
reference: [],
|
|
616
620
|
searchReference: [],
|
|
617
|
-
messageTime:
|
|
621
|
+
messageTime: wt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
|
|
618
622
|
actions: [],
|
|
619
623
|
isLoading: !1
|
|
620
624
|
},
|
|
@@ -622,28 +626,28 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
622
626
|
markdown: s == null ? void 0 : s.markdown
|
|
623
627
|
}) : null;
|
|
624
628
|
}, [o == null ? void 0 : o.arrange, v]);
|
|
625
|
-
return
|
|
629
|
+
return vn(k, () => ({
|
|
626
630
|
getCurrentInputText: () => {
|
|
627
631
|
var t;
|
|
628
|
-
return (t =
|
|
632
|
+
return (t = le.current) == null ? void 0 : t.getCurrentText();
|
|
629
633
|
}
|
|
630
634
|
})), /* @__PURE__ */ z("div", {
|
|
631
635
|
className: "agent-chat",
|
|
632
|
-
children: [
|
|
636
|
+
children: [Kt ? /* @__PURE__ */ c("div", {
|
|
633
637
|
className: "session-loading",
|
|
634
|
-
children: /* @__PURE__ */ c(
|
|
635
|
-
}) : /* @__PURE__ */ z(
|
|
636
|
-
children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(
|
|
637
|
-
ref:
|
|
638
|
+
children: /* @__PURE__ */ c(mt, {})
|
|
639
|
+
}) : /* @__PURE__ */ z(un, {
|
|
640
|
+
children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(Mn, {
|
|
641
|
+
ref: Ae,
|
|
638
642
|
appId: o.id,
|
|
639
643
|
currentSession: e,
|
|
640
644
|
promptVariables: O,
|
|
641
|
-
setPromptVariables:
|
|
645
|
+
setPromptVariables: ue,
|
|
642
646
|
setCurrentSession: p
|
|
643
647
|
}), /* @__PURE__ */ z("div", {
|
|
644
648
|
className: "chat-main",
|
|
645
649
|
id: "chat-main",
|
|
646
|
-
style:
|
|
650
|
+
style: Nt,
|
|
647
651
|
children: [/* @__PURE__ */ c("div", {
|
|
648
652
|
className: "chat-main-wrapper",
|
|
649
653
|
id: "scrollableDiv",
|
|
@@ -654,75 +658,75 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
654
658
|
flexDirection: "column-reverse"
|
|
655
659
|
},
|
|
656
660
|
ref: H,
|
|
657
|
-
onScroll:
|
|
658
|
-
children: (
|
|
661
|
+
onScroll: tn,
|
|
662
|
+
children: (tt = e == null ? void 0 : e.data) != null && tt.id && (v != null && v.length) ? /* @__PURE__ */ z(Vn, {
|
|
659
663
|
dataLength: v.length,
|
|
660
|
-
next:
|
|
664
|
+
next: rn,
|
|
661
665
|
style: {
|
|
662
666
|
display: "flex",
|
|
663
667
|
flexDirection: "column-reverse",
|
|
664
668
|
overflowX: "hidden"
|
|
665
669
|
},
|
|
666
670
|
inverse: !0,
|
|
667
|
-
endMessage: v.length >
|
|
668
|
-
((
|
|
671
|
+
endMessage: v.length > vt && // 少于一页不展示这个提示
|
|
672
|
+
((nt = H.current) != null && nt.scrollTop) && ((it = H.current) == null ? void 0 : it.scrollTop) < -10 ? /* @__PURE__ */ c(kn, {
|
|
669
673
|
plain: !0,
|
|
670
674
|
children: "没有更多数据了"
|
|
671
675
|
}) : null,
|
|
672
|
-
hasMore:
|
|
676
|
+
hasMore: Ke,
|
|
673
677
|
loader: /* @__PURE__ */ c("div", {
|
|
674
678
|
style: {
|
|
675
679
|
height: "50px",
|
|
676
680
|
textAlign: "center",
|
|
677
681
|
overflow: "hidden"
|
|
678
682
|
},
|
|
679
|
-
children: /* @__PURE__ */ c(
|
|
683
|
+
children: /* @__PURE__ */ c(mt, {})
|
|
680
684
|
}),
|
|
681
685
|
scrollableTarget: "scrollableDiv",
|
|
682
|
-
children: [v.map((t, n) => /* @__PURE__ */ c(
|
|
686
|
+
children: [v.map((t, n) => /* @__PURE__ */ c(Yn, {
|
|
683
687
|
application: o,
|
|
684
688
|
currentSession: e,
|
|
685
689
|
history: t,
|
|
686
690
|
docViewerUrl: Y,
|
|
687
691
|
isLastHistory: n === 0,
|
|
688
|
-
onRelatedClick:
|
|
689
|
-
onAgainClick:
|
|
690
|
-
onEditClick:
|
|
692
|
+
onRelatedClick: on,
|
|
693
|
+
onAgainClick: sn,
|
|
694
|
+
onEditClick: nn,
|
|
691
695
|
markdown: s == null ? void 0 : s.markdown
|
|
692
|
-
}, t.messageId + n)),
|
|
696
|
+
}, t.messageId + n)), !Ke && et]
|
|
693
697
|
}) : /* @__PURE__ */ z("div", {
|
|
694
698
|
className: "main-empty",
|
|
695
|
-
children: [(s == null ? void 0 : s.greeting) !== !1 && /* @__PURE__ */ c(
|
|
696
|
-
text: s === void 0 || s.greeting === !0 || ((
|
|
697
|
-
icon: s === void 0 || s.greeting === !0 || ((
|
|
698
|
-
children: !!
|
|
699
|
-
ref:
|
|
700
|
-
sid: (
|
|
701
|
-
isRecommendClearing:
|
|
702
|
-
data:
|
|
699
|
+
children: [(s == null ? void 0 : s.greeting) !== !1 && /* @__PURE__ */ c(Fn, {
|
|
700
|
+
text: s === void 0 || s.greeting === !0 || ((ot = s.greeting) == null ? void 0 : ot.text) === void 0 ? pt.text : s.greeting.text,
|
|
701
|
+
icon: s === void 0 || s.greeting === !0 || ((st = s.greeting) == null ? void 0 : st.icon) === void 0 ? Ct || pt.icon : s.greeting.icon,
|
|
702
|
+
children: !!je.length && (((s == null ? void 0 : s.greeting) === void 0 || (s == null ? void 0 : s.greeting)) === !0 || typeof (s == null ? void 0 : s.greeting) == "object" && s.greeting.questions !== !1) && /* @__PURE__ */ c(Tn, {
|
|
703
|
+
ref: Ie,
|
|
704
|
+
sid: (rt = e == null ? void 0 : e.data) == null ? void 0 : rt.id,
|
|
705
|
+
isRecommendClearing: ze,
|
|
706
|
+
data: je,
|
|
703
707
|
layoutBreakpoints: typeof (s == null ? void 0 : s.greeting) == "object" ? s.greeting.layoutBreakpoints : void 0,
|
|
704
708
|
onItemClick: (t) => {
|
|
705
709
|
var a, i, l;
|
|
706
|
-
if (
|
|
710
|
+
if (se(t == null ? void 0 : t.question), X(t == null ? void 0 : t.question), ze)
|
|
707
711
|
return;
|
|
708
712
|
t != null && t.id && G(!0);
|
|
709
713
|
const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
|
|
710
|
-
g != null && g.fileUpload ? (l = (i =
|
|
714
|
+
g != null && g.fileUpload ? (l = (i = fe.current) == null ? void 0 : i.clear()) == null || l.then(() => {
|
|
711
715
|
var r, d;
|
|
712
|
-
t != null && t.id && (n ? (r =
|
|
716
|
+
t != null && t.id && (n ? (r = Je(n, t)) == null || r.finally(() => {
|
|
713
717
|
G(!1);
|
|
714
|
-
}) : (G(!1), M(!0), (d =
|
|
718
|
+
}) : (G(!1), M(!0), (d = Se()) == null || d.then((b) => {
|
|
715
719
|
var y;
|
|
716
|
-
(y =
|
|
720
|
+
(y = Je(b.id, t)) == null || y.finally(() => {
|
|
717
721
|
G(!1);
|
|
718
722
|
});
|
|
719
723
|
})));
|
|
720
|
-
}) : n ? G(!1) : (G(!1), M(!0),
|
|
724
|
+
}) : n ? G(!1) : (G(!1), M(!0), Se());
|
|
721
725
|
}
|
|
722
726
|
})
|
|
723
|
-
}),
|
|
727
|
+
}), et]
|
|
724
728
|
})
|
|
725
|
-
}),
|
|
729
|
+
}), Be && /* @__PURE__ */ c("div", {
|
|
726
730
|
className: "session-stop",
|
|
727
731
|
children: /* @__PURE__ */ c(W, {
|
|
728
732
|
type: "primary",
|
|
@@ -731,24 +735,24 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
731
735
|
},
|
|
732
736
|
ghost: !0,
|
|
733
737
|
size: "small",
|
|
734
|
-
icon: /* @__PURE__ */ c(
|
|
738
|
+
icon: /* @__PURE__ */ c(ie, {
|
|
735
739
|
type: "icon-zantinghuida",
|
|
736
740
|
style: {
|
|
737
741
|
fontSize: 16
|
|
738
742
|
}
|
|
739
743
|
}),
|
|
740
|
-
onClick: () =>
|
|
744
|
+
onClick: () => St(),
|
|
741
745
|
children: "停止回答"
|
|
742
746
|
})
|
|
743
|
-
}),
|
|
747
|
+
}), $e && (v == null ? void 0 : v.length) > 0 && /* @__PURE__ */ c("div", {
|
|
744
748
|
className: "back-bottom",
|
|
745
749
|
children: /* @__PURE__ */ c(W, {
|
|
746
750
|
size: "small",
|
|
747
|
-
onClick: () =>
|
|
751
|
+
onClick: () => en({
|
|
748
752
|
behavior: "smooth"
|
|
749
753
|
}),
|
|
750
754
|
type: "link",
|
|
751
|
-
icon: /* @__PURE__ */ c(
|
|
755
|
+
icon: /* @__PURE__ */ c(ie, {
|
|
752
756
|
type: "icon-yijianhuidaodibu",
|
|
753
757
|
style: {
|
|
754
758
|
fontSize: 24
|
|
@@ -762,25 +766,25 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
762
766
|
className: "chat-footer-input",
|
|
763
767
|
children: [S && /* @__PURE__ */ c("div", {
|
|
764
768
|
className: "input-files",
|
|
765
|
-
children: /* @__PURE__ */ c(
|
|
769
|
+
children: /* @__PURE__ */ c(Ln, {
|
|
766
770
|
file: S,
|
|
767
771
|
actions: {
|
|
768
|
-
upload:
|
|
772
|
+
upload: Jt,
|
|
769
773
|
remove: () => {
|
|
770
774
|
Q(void 0);
|
|
771
775
|
}
|
|
772
776
|
},
|
|
773
|
-
onUrlChange: (t) =>
|
|
777
|
+
onUrlChange: (t) => ae(t)
|
|
774
778
|
})
|
|
775
|
-
}), /* @__PURE__ */ z(
|
|
779
|
+
}), /* @__PURE__ */ z(me, {
|
|
776
780
|
className: "footer-upload-action",
|
|
777
781
|
onClick: (t) => t.preventDefault(),
|
|
778
|
-
children: [/* @__PURE__ */ z(
|
|
779
|
-
children: [o.type === 2 && (g == null ? void 0 : g.imageUpload) && /* @__PURE__ */ c(
|
|
782
|
+
children: [/* @__PURE__ */ z(me, {
|
|
783
|
+
children: [o.type === 2 && (g == null ? void 0 : g.imageUpload) && /* @__PURE__ */ c(wn, {
|
|
780
784
|
disabled: !!S || R,
|
|
781
785
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
782
786
|
listType: "picture-card",
|
|
783
|
-
beforeUpload:
|
|
787
|
+
beforeUpload: Zt,
|
|
784
788
|
className: "footer-upload-picture",
|
|
785
789
|
showUploadList: !1,
|
|
786
790
|
children: S ? /* @__PURE__ */ c(W, {
|
|
@@ -792,13 +796,13 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
792
796
|
bottom: "-2px"
|
|
793
797
|
},
|
|
794
798
|
disabled: !!S || R,
|
|
795
|
-
icon: /* @__PURE__ */ c(
|
|
799
|
+
icon: /* @__PURE__ */ c(Hn, {
|
|
796
800
|
className: "icon-tianjia",
|
|
797
801
|
style: {
|
|
798
802
|
fontSize: "22px"
|
|
799
803
|
}
|
|
800
804
|
})
|
|
801
|
-
}) : /* @__PURE__ */ c(
|
|
805
|
+
}) : /* @__PURE__ */ c(bn, {
|
|
802
806
|
placement: "topLeft",
|
|
803
807
|
overlayClassName: "footer-upload-tooltip",
|
|
804
808
|
title: /* @__PURE__ */ c("div", {
|
|
@@ -812,7 +816,7 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
812
816
|
position: "relative",
|
|
813
817
|
bottom: "-2px"
|
|
814
818
|
},
|
|
815
|
-
icon: /* @__PURE__ */ c(
|
|
819
|
+
icon: /* @__PURE__ */ c(ie, {
|
|
816
820
|
type: "icon-Vector",
|
|
817
821
|
className: "icon-tianjia",
|
|
818
822
|
style: {
|
|
@@ -821,13 +825,13 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
821
825
|
})
|
|
822
826
|
})
|
|
823
827
|
})
|
|
824
|
-
}),
|
|
828
|
+
}), ve && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(Dn, {
|
|
825
829
|
appId: o == null ? void 0 : o.id,
|
|
826
|
-
ref:
|
|
827
|
-
isFirstSession:
|
|
830
|
+
ref: fe,
|
|
831
|
+
isFirstSession: Ye,
|
|
828
832
|
docViewerUrl: Y,
|
|
829
833
|
onStatusChange: (t) => j(void 0, null, function* () {
|
|
830
|
-
t !== "process" ? (
|
|
834
|
+
t !== "process" ? (ge(!0), Pe()) : ge(!1);
|
|
831
835
|
}),
|
|
832
836
|
createSession: () => new Promise((t) => {
|
|
833
837
|
M(!0), L == null || L({
|
|
@@ -839,10 +843,10 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
839
843
|
t(a);
|
|
840
844
|
});
|
|
841
845
|
}),
|
|
842
|
-
sid: (
|
|
843
|
-
disabled:
|
|
846
|
+
sid: (at = e == null ? void 0 : e.data) == null ? void 0 : at.id,
|
|
847
|
+
disabled: Ne || R,
|
|
844
848
|
afterFileAdd: (t, n) => {
|
|
845
|
-
n &&
|
|
849
|
+
n && ce((a) => {
|
|
846
850
|
const i = a[n] || [];
|
|
847
851
|
return {
|
|
848
852
|
[n]: [...i, t]
|
|
@@ -852,7 +856,7 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
852
856
|
afterFileDelete: (t) => {
|
|
853
857
|
var a;
|
|
854
858
|
const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
|
|
855
|
-
n &&
|
|
859
|
+
n && ce((i) => {
|
|
856
860
|
const l = i[n] || [];
|
|
857
861
|
return {
|
|
858
862
|
[n]: l.filter((r) => r.id !== t)
|
|
@@ -860,43 +864,43 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
860
864
|
});
|
|
861
865
|
},
|
|
862
866
|
onFileListChange: (t) => {
|
|
863
|
-
|
|
867
|
+
jt(t);
|
|
864
868
|
},
|
|
865
|
-
shouldContinue:
|
|
869
|
+
shouldContinue: Vt,
|
|
866
870
|
afterFilesClear: () => {
|
|
867
871
|
var n;
|
|
868
872
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
869
|
-
t && (
|
|
873
|
+
t && (ce({
|
|
870
874
|
[t]: []
|
|
871
|
-
}),
|
|
875
|
+
}), Pe());
|
|
872
876
|
}
|
|
873
|
-
}) : null, (g == null ? void 0 : g.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(
|
|
877
|
+
}) : null, (g == null ? void 0 : g.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(qn, {
|
|
874
878
|
appId: o.id,
|
|
875
879
|
list: [],
|
|
876
|
-
search:
|
|
880
|
+
search: Ve ? Ht : "",
|
|
877
881
|
onPromptSelect: (t) => {
|
|
878
|
-
X(t.context),
|
|
882
|
+
X(t.context), se(t.context);
|
|
879
883
|
},
|
|
880
884
|
disabled: R
|
|
881
885
|
})]
|
|
882
|
-
}), /* @__PURE__ */ z(
|
|
883
|
-
children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((
|
|
884
|
-
sessionId: (
|
|
886
|
+
}), /* @__PURE__ */ z(me, {
|
|
887
|
+
children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((lt = o.arrange) == null ? void 0 : lt.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(An, {
|
|
888
|
+
sessionId: (dt = e == null ? void 0 : e.data) == null ? void 0 : dt.id,
|
|
885
889
|
netStatus: E,
|
|
886
|
-
enable: typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.diabled) == "boolean" ? !(s != null && s.connectNetwork.diabled) :
|
|
890
|
+
enable: typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.diabled) == "boolean" ? !(s != null && s.connectNetwork.diabled) : Yt,
|
|
887
891
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
888
892
|
onNetStatusChange: (t) => {
|
|
889
|
-
|
|
893
|
+
an(t);
|
|
890
894
|
}
|
|
891
|
-
}), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(
|
|
892
|
-
currentSessionId: (
|
|
895
|
+
}), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(jn, {
|
|
896
|
+
currentSessionId: (ct = e == null ? void 0 : e.data) == null ? void 0 : ct.id,
|
|
893
897
|
onSessionChange: (t, n) => {
|
|
894
|
-
X(void 0),
|
|
898
|
+
X(void 0), Le(!0), p == null || p(n);
|
|
895
899
|
},
|
|
896
900
|
disabled: R
|
|
897
|
-
}),
|
|
901
|
+
}), Lt && Et === "float" && /* @__PURE__ */ c("div", {
|
|
898
902
|
className: "session-history-drawer-component",
|
|
899
|
-
children: /* @__PURE__ */ c(
|
|
903
|
+
children: /* @__PURE__ */ c(xn, {
|
|
900
904
|
placement: "topRight",
|
|
901
905
|
showArrow: !1,
|
|
902
906
|
overlayClassName: "session-history-overlay",
|
|
@@ -909,84 +913,84 @@ ${t}` : t, l = new ie(i, a, J.User, n);
|
|
|
909
913
|
className: "history-overlay-action",
|
|
910
914
|
disabled: R,
|
|
911
915
|
type: "text",
|
|
912
|
-
icon: /* @__PURE__ */ c(
|
|
916
|
+
icon: /* @__PURE__ */ c(ie, {
|
|
913
917
|
type: "icon-lishijilu",
|
|
914
918
|
style: {
|
|
915
919
|
fontSize: 24
|
|
916
920
|
}
|
|
917
921
|
}),
|
|
918
|
-
onClick: () =>
|
|
922
|
+
onClick: () => _e(!0)
|
|
919
923
|
})
|
|
920
924
|
})
|
|
921
925
|
}), (g == null ? void 0 : g.sessionOpen) && /* @__PURE__ */ c(W, {
|
|
922
|
-
icon: /* @__PURE__ */ c(
|
|
926
|
+
icon: /* @__PURE__ */ c(Rn, {}),
|
|
923
927
|
className: "add-btn",
|
|
924
928
|
type: "primary",
|
|
925
|
-
disabled:
|
|
929
|
+
disabled: Be || !e || !v.length || R,
|
|
926
930
|
onClick: () => {
|
|
927
931
|
var t, n;
|
|
928
|
-
p == null || p(null), P(!1), (t =
|
|
932
|
+
p == null || p(null), P(!1), (t = Ae.current) == null || t.clear(), (n = Ie.current) == null || n.clear();
|
|
929
933
|
},
|
|
930
934
|
children: "新会话"
|
|
931
935
|
})]
|
|
932
936
|
})]
|
|
933
937
|
}), /* @__PURE__ */ c("div", {
|
|
934
938
|
className: "footer-textarea",
|
|
935
|
-
children: /* @__PURE__ */ c(
|
|
936
|
-
ref:
|
|
937
|
-
maxLength:
|
|
938
|
-
text:
|
|
939
|
+
children: /* @__PURE__ */ c(Pn, {
|
|
940
|
+
ref: le,
|
|
941
|
+
maxLength: Pt,
|
|
942
|
+
text: Dt,
|
|
939
943
|
networkStatus: !1,
|
|
940
|
-
loading:
|
|
941
|
-
disabled:
|
|
942
|
-
onTextSend:
|
|
944
|
+
loading: We || te,
|
|
945
|
+
disabled: De || Me || R || We || te,
|
|
946
|
+
onTextSend: Ge,
|
|
943
947
|
onChange: (t, n) => {
|
|
944
948
|
X(t);
|
|
945
949
|
const a = n.getText().replace(/[\n\s]+$/, "");
|
|
946
|
-
|
|
950
|
+
se(a), Rt(a), Ve || Ot(!0);
|
|
947
951
|
},
|
|
948
|
-
clearAction: /* @__PURE__ */ c(
|
|
952
|
+
clearAction: /* @__PURE__ */ c(me, {
|
|
949
953
|
size: 0,
|
|
950
954
|
children: /* @__PURE__ */ c(W, {
|
|
951
955
|
type: "link",
|
|
952
|
-
disabled:
|
|
956
|
+
disabled: Ne || R,
|
|
953
957
|
ghost: !0,
|
|
954
|
-
icon: /* @__PURE__ */ c(
|
|
958
|
+
icon: /* @__PURE__ */ c(ie, {
|
|
955
959
|
style: {
|
|
956
960
|
fontSize: 22
|
|
957
961
|
},
|
|
958
962
|
type: "icon-qingchujiyi"
|
|
959
963
|
}),
|
|
960
|
-
onClick: () =>
|
|
964
|
+
onClick: () => Gt()
|
|
961
965
|
})
|
|
962
966
|
})
|
|
963
967
|
})
|
|
964
968
|
})]
|
|
965
969
|
})
|
|
966
|
-
}), /* @__PURE__ */ c(
|
|
967
|
-
tips:
|
|
968
|
-
}),
|
|
969
|
-
isvisible:
|
|
970
|
-
files:
|
|
971
|
-
sessionId: (
|
|
970
|
+
}), /* @__PURE__ */ c(On, {
|
|
971
|
+
tips: It
|
|
972
|
+
}), qe && /* @__PURE__ */ c(Un, {
|
|
973
|
+
isvisible: qe,
|
|
974
|
+
files: Mt,
|
|
975
|
+
sessionId: (ft = e == null ? void 0 : e.data) == null ? void 0 : ft.id,
|
|
972
976
|
onClose: (t) => {
|
|
973
|
-
|
|
977
|
+
Ut(!1), At(!1);
|
|
974
978
|
}
|
|
975
979
|
})]
|
|
976
|
-
}),
|
|
980
|
+
}), Qe && /* @__PURE__ */ c(zn, {
|
|
977
981
|
currentSession: e,
|
|
978
982
|
application: o,
|
|
979
983
|
networkStatus: E,
|
|
980
984
|
setCurrentSession: p,
|
|
981
985
|
disabled: R,
|
|
982
|
-
isSessionHistoryVisible:
|
|
983
|
-
setIsSessionHistoryVisible:
|
|
986
|
+
isSessionHistoryVisible: Qe,
|
|
987
|
+
setIsSessionHistoryVisible: _e,
|
|
984
988
|
onSessionChange: (t) => {
|
|
985
|
-
|
|
989
|
+
Le(!0);
|
|
986
990
|
}
|
|
987
991
|
})]
|
|
988
992
|
});
|
|
989
993
|
});
|
|
990
994
|
export {
|
|
991
|
-
|
|
995
|
+
xi as default
|
|
992
996
|
};
|